package user

import (
	"context"

	"gitee.com/krio/grpc-go-server/cmd/lib"
	"gitee.com/krio/grpc-go-server/dao/model"
	"gitee.com/krio/grpc-go-server/dao/model/user"
)

type UserLoginDao struct {
}

func (ul *UserLoginDao) OneByID(ctx context.Context, userID int32) (*user.UserLogin, bool, error) {
	var d *user.UserLogin
	exi, err := lib.X.Table(model.TableUserLogin).Where("sfid=?", userID).Get(&d)
	if err != nil {
		return nil, false, err
	}
	if !exi {
		return nil, false, nil
	}

	return d, true, nil
}

// TODO
func (ul *UserLoginDao) OneBySFID(ctx context.Context, sFID string) (*user.UserLogin, bool, error) {
	return nil, false, nil
}
